
package com.welsy.usermgt.model
{
   import com.adobe.cairngorm.model.ModelLocator;
   import com.welsy.usermgt.vo.UsrResultVO;
   import com.welsy.usermgt.vo.UserVO;
   import mx.collections.ArrayCollection;
   import com.welsy.usermgt.vo.ClassVO;     
     
   [Bindable]
   public class UserMgtModelLocator implements ModelLocator
   {
      private static var modelLocator : UserMgtModelLocator;
      
      public static function getInstance() : UserMgtModelLocator 
      {
      	if ( modelLocator == null )
      	{
      		modelLocator = new UserMgtModelLocator();
      	}
      		
      	return modelLocator;
      }
      
      //Constructor should be private but current AS3.0 does not allow it yet (?)...
      public function UserMgtModelLocator() 
      {	
         if ( modelLocator != null )
         {
         	throw new Error( "Only one UserMgtModelLocator instance should be instantiated" );	
         }         
      }
      
      public var searchType : Number = STANDARD_SEARCH;
      public var searchDataType : Number = LOCAL_DATA;
      
      public static var STANDARD_SEARCH : Number = 0;
      public static var ADVANCED_SEARCH : Number = 1;
      
      public static var SUBSYSTEM_DATA : Number = 0;
      public static var LOCAL_DATA : Number = 1;
      
      //added by CAA
      public var selectedUser : UserVO;
      public var selectedUsers : ArrayCollection/* UserVO */;
      
      public var result : UsrResultVO;
      public var userRolesTag : ArrayCollection = new ArrayCollection; //Array of Strings
      public var userRolesId : ArrayCollection = new ArrayCollection; //Array of integers
      
      public var innerSearch : Boolean = false; //If the search was internal
      public var srcCriteriaSSID : int = 0;      
      public var userEditable : Boolean = false; //If the search was internal and an internal user is selected
      
      public var currentClass : ClassVO = new ClassVO; //The current class (for composing purposes)
      public var classEditingSucceeded : Boolean = false; //Whether users have been removed or not
      
      public var lastEditingRole : int = 0; //When trying to change a user role - just to provide a fallback
                         
   }

}
